#include <cstring>
#include <iostream>
#include <set>
#include <vector>

/**
 * NowCoder KY53 Counterfeit Dollar
 */

enum Balance { EVEN, UP, DOWN };

struct Weighing {
    std::vector<int> left, right;
    Balance balance;

    bool leftContain(int tgt) const {
        for (int i = 0; i < left.size(); i++)
            if (left[i] == tgt) return true;
        return false;
    }

    bool rightContain(int tgt) const {
        for (int i = 0; i < right.size(); i++)
            if (right[i] == tgt) return true;
        return false;
    }
};

std::set<int> susp;
std::vector<Weighing> weighs;

inline int toIndex(char c) { return c - 'A'; }

void solve() {
    for (std::set<int>::iterator it = susp.begin(); it != susp.end(); it++) {
        // Find coin that appear on same side of unbalanced weighing
        int idx = *it;
        bool onLeft = weighs[0].leftContain(idx);
        bool onRight = weighs[0].rightContain(idx);
        if (!onLeft && !onRight) continue;
        bool light = (onLeft && weighs[0].balance == DOWN) ||
                     (onRight && weighs[0].balance == UP);
        bool yes = true;
        for (int i = 1; i < weighs.size(); i++) {
            bool onLeft = weighs[i].leftContain(idx);
            bool onRight = weighs[i].rightContain(idx);
            if (!onLeft && !onRight) {
                yes = false;
                break;
            }
            bool curLight = (onLeft && weighs[i].balance == DOWN) ||
                            (onRight && weighs[i].balance == UP);
            if (curLight != light) {
                yes = false;
                break;
            }
        }
        if (!yes) continue;

        // Print result
        char label = char(idx) + 'A';
        std::cout << label << " is the counterfeit coin and it is "
                  << (light ? "light" : "heavy") << ".\n";
        break;
    }
}

int main() {
    for (int i = 0; i < 12; i++) susp.insert(i);
    for (int i = 0; i < 3; i++) {
        std::string left, right, bal;
        std::cin >> left >> right >> bal;
        if (bal == "even") {
            for (int i = 0; i < left.length(); i++) {
                susp.erase(toIndex(left[i]));
                susp.erase(toIndex(right[i]));
            }
        } else {
            Weighing w;
            for (int i = 0; i < left.length(); i++) {
                w.left.push_back(toIndex(left[i]));
                w.right.push_back(toIndex(right[i]));
            }
            w.balance = bal == "up" ? UP : DOWN;
            weighs.push_back(w);
        }
    }

    solve();
}